﻿#include <iostream>
#include <iostream>
#include <vector>
#include "serialize/TestSerialize.h"
#include "json.hpp"

int main() {
    Object object{"paidaxing",28,172,true};
    Student student{"paidaxing",28,172,true};
    student._vecFriendsNames.push_back("haimainbaobao");
    student._vecFriendsNames.emplace_back("zhangyuge");
    student._mapBankCards[1]="11001101";
    Complex complex;
    complex._vecStudents.emplace_back(student);
    complex._index=10;
    std::cout<<nlohmann::json(complex).dump()<<std::endl;
    std::string strJson=R"({"index":0,"vecStudents"
    :[{"age":28,"gender":true,"height":172.0,"mapBankCards":[[1,"11001101"]],
    "name":"paidaxing","vecFriendsNames":["haimainbaobao","zhangyuge"]}]})";
    nlohmann::json j=nlohmann::json::parse(strJson);
    Complex complex1;
    from_json(j,complex1);
    std::cout<<complex1._vecStudents.front()._vecFriendsNames.front()<<std::endl;
    return 0;
}
